import {
  timingTask,
  addTask,
  modificationTask,
  singleStrip,
  deleteJob,
  resumeJob,
  pauseJob,
  runJobNow
} from '@/api/platformManage/index'
const app = {
  actions: {
    // 获取任务列表内容
    TimingTask({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        timingTask(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 任务新增
    AddTask({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        addTask(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 任务修改
    ModificationTask({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        modificationTask(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 单条任务查询
    SingleStrip({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        singleStrip(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 删除
    DeleteJob({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        deleteJob(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 恢复
    ResumeJob({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        resumeJob(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 暂停
    PauseJob({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        pauseJob(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 立即执行
    RunJobNow({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        runJobNow(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    }

  }
}

export default app
